package com.example.springvue.controller.admin;

import com.example.springvue.common.annotation.LogAnnotation;
import com.example.springvue.common.handler.AdminUserHeaderHodler;
import com.example.springvue.common.handler.NotExistException;
import com.example.springvue.common.returnthrow.Result;
import com.example.springvue.common.utils.CommonUtils;
import com.example.springvue.model.AdminUser;
import com.example.springvue.service.AdminLogService;
import com.example.springvue.service.AdminUserService;
import com.example.springvue.service.AuthGroupService;
import com.example.springvue.service.AuthRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
public class AdminLogController {

    @Autowired
    AdminLogService adminLogService;



    /**
     * 管理员列表
     *
     * @return
     */
    @LogAnnotation
    @ResponseBody
    @PostMapping(value = "/admin/log/list")
    public Result<Map< String, Object >> getAdminLoginList(@RequestBody Map<String, Object> Body) throws NotExistException {
        try{
            int pageSize = (int) Body.get("pageSize");
            int page = (int) Body.get("page");
            Map<String, Object>  authRule = adminLogService.getList(pageSize,page,Body);
            return Result.success("请求成功",authRule);
        }
        catch (NotExistException e)
        {
            throw new NotExistException(e.getMessage());
        }
    }


}
